package org.jeecg.modules.product.message;

import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.exceptions.ClientException;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.constant.enums.DySmsEnum;
import org.jeecg.common.util.DySmsHelper;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

@Slf4j
public class messageTest implements Job {
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        String parameter = String.valueOf(jobExecutionContext.getMergedJobDataMap().get("parameter"));//获取前端配置过来的积分配置编号
        log.info("定时任务执行-----------发送短信-------------------------");
        try {
            JSONObject obj = new JSONObject();
            obj.put("code", "1234");
            DySmsHelper.sendSms(parameter, obj, DySmsEnum.PPX_TEMPLATE_CODE);
        } catch (ClientException e) {
            log.error("------发送短信异常--------------"+e);
            throw new RuntimeException(e);
        }
        log.info("定时任务执行-----------发送短信完成-------------------------");
    }
}
